﻿using Microsoft.Extensions.Options;
using NumericUpDownLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using XYAC.Framework.MonitorTireMaterialManual.Entities;
using XYAC.Framework.MonitorTireMaterialManual.Extensions;
using XYAC.Framework.MonitorTireMaterialManual.ViewModels;

namespace XYAC.Framework.MonitorTireMaterialManual.Views.ReadonlyView
{
    /// <summary>
    /// SemiSteelTreadScanView.xaml 的交互逻辑
    /// </summary>
    public partial class SemiSteelTreadScanReadonlyView : UserControl
    {
        public IOptionsMonitor<AppConfig> AppConfig { get; }
        public SemiSteelTreadScanViewModel ViewModel { get; }

        private IServiceProvider provider;

        public SemiSteelTreadScanReadonlyView(IOptionsMonitor<AppConfig> appConfig, SemiSteelTreadScanViewModel viewmodel, IServiceProvider provider)
        {
            this.DataContext = this.ViewModel = viewmodel;
            this.ViewModel.CloseWindow = () =>
            {

                if (this.Parent is Window win)
                {
                    win.DialogResult = true;
                    win.Close();
                }
            };
            this.AppConfig = appConfig;
            this.provider = provider;
            InitializeComponent();
        }


        internal void ClearViewModelValue()
        {
            this.ViewModel.SemiSteelTreadScanReport = null;
        }
    }
}
